const { spawn } = require("child_process")
function start(...args) {
  return new Promise(resolve => {
    //1.开启子进程
    const child_process = spawn(...args)
    //2.子进程输出错误 (stdio冲突:stdio能直接连接到父进程的stdouot终端环境到子程序)
    //child_process.stdout.pipe(process.stdout)
    //child_process.stderr.pipe(process.stderr)
    //3.监听子进程的关闭事件
    child_process.on("close", () => {
      resolve()
    })
  })
}

module.exports = start
